<template>
  <view>
    <text>测试页面</text>

    <view>
      <input v-model="echo" type="text" placeholder="echo" />
      <button @click="send">发送</button>
    </view>

    <view>
      <text>{{info}}</text>
    </view>

    <view>
      <input type="text" v-model="loginfo.logType" placeholder="类型" />
      <input type="text" v-model="loginfo.logInfo" placeholder="内容" />
      <button @click="sendPost">post请求</button>
    </view>

    <view>
      {{ postinfo }}
    </view>


  </view>
</template>

<script setup>
  import {
    ref
  } from 'vue'

  import {
    api
  } from '../../api/api.js'

  const echo = ref('')
  const info = ref('')

  const send = () => {
    api.get('/test/echo', {
      echo: echo.value
    }, (data) => {
      info.value = JSON.stringify(data)
    })
  }

  // post提交测试

  const loginfo = ref({
    "lid": 110,
    "logType": "",
    "logInfo": "",
    "lastupdate": "2021-01-02 10:11:12"
  })

  const postinfo = ref('')

  const sendPost = () => {
    api.post('/test/converter/json', loginfo.value, (data) => {
      postinfo.value = JSON.stringify(data)
    })
  }
</script>

<style>

</style>